package model;

import java.io.Serializable;
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.LinkedList;

import Servises.SaxXmlParser;

public class GameInfo implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public Dictionary<Integer, Movie> movies ;
	public Dictionary<Integer, Element> elements;
	public Dictionary<String, Boolean> flags;
	public Dictionary<String, Boolean> flagsInitialValue;
	public int startMovieId;

	public Dictionary<Integer, Element> getElements() {
		return elements;
	}

	public void setElements(Dictionary<Integer, Element> elements) {
		this.elements = elements;
	}


	
	public GameInfo(Dictionary<Integer, Movie> movies,Dictionary<Integer, Element> elements, int startMovieId,
					Dictionary<String, Boolean> flags) {
		super();
		this.movies = movies;
		this.elements = elements;
		this.startMovieId = startMovieId;
		this.flags = flags;
	}
	
	

	public GameInfo() {
		super();
		movies = new Hashtable<Integer, Movie>();
		elements = new Hashtable<Integer, Element>();
		flags = new Hashtable<String, Boolean>();
		flagsInitialValue = new Hashtable<String, Boolean>();
	}
	
	public Dictionary<Integer, Movie> getMovies() {
		return movies;
	}

	public void setMovies(Dictionary<Integer, Movie> movies) {
		this.movies = movies;
	}
	
	public Dictionary<String, Boolean> getFlags() {
		return flags;
	}

	public void setFlags(Dictionary<String, Boolean> flags) {
		this.flags = flags;
	}
	
	public void ImportFromXml(String path) throws Exception
	{
		if (!SaxXmlParser.initParser(path))
			throw new Exception("Error parsing the xml");
		movies =  SaxXmlParser.parseMovies();
		elements = SaxXmlParser.parseElements();
		startMovieId = SaxXmlParser.parseMovieStartId();
		flags = SaxXmlParser.parseFlags();
		SaxXmlParser.freeParser();
	}



	
	
	

}
